/*
 * 上海远境文化传媒有限公司 版权所有
 */
package facade.open.response;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * 支持ability.
 */
public class ResponseWithAbility {

    /**
     * 资源能力.
     *
     * 标准能力有：
     *      edit - 编辑
     *      delete - 删除
     *      close - 关闭
     */
    public Set<String> abilities = new LinkedHashSet<>();

    public void addAbility(String ability) {
        if (this.abilities == null) {
            this.abilities = new LinkedHashSet<>();
        }
        this.abilities.add(ability);
    }

    public void removeAbility(String ability) {
        if (this.abilities != null) {
            this.abilities.remove(ability);
        }
    }

    public boolean hasAbility(String ability) {
        return this.abilities != null && this.abilities.contains(ability);
    }
}
